//
//  Node.hpp
//  Simulation
//
//  Created by Christopher Kemsley on 3/3/12.
//  Copyright (c) 2012 iAppolopolis. All rights reserved.
//

#ifndef Simulation_Node_hpp
#define Simulation_Node_hpp

#include "Types.hpp"
#include "URL.hpp"

#include "Timer.hpp"
#include "Invocation.hpp"

#include "Codec.hpp"

#include <ostream>

NamespaceBegin





struct	ModelVariant
{
	std::string	builderName ;
	std::string	instanceName ;
	URL			configURL ;
	
	
	ModelVariant ( ) ;
	ModelVariant ( ModelVariant const & copy ) ;
	~ModelVariant () ;
	
	bool			isComplete () ;
	ModelVariant&	operator=	( ModelVariant const & copy ) ;
	
	friend std::ostream&	operator<<	( std::ostream& stream , ModelVariant const & variant ) ;
} ;






class	Model
{
public:
	
	virtual ~Model () { }
	
	Model	( ModelVariant const & inIdentity )
	:	identity(inIdentity) { }
	
	ModelVariant const	identity ;
} ;




template <typename SettingsType>
struct	ConfiguredModel : public Model
{
	SettingsType	mConfig ;
	
	ConfiguredModel	( ModelVariant const & identity )
	:	Model	( identity )
	,	mConfig	( identity.instanceName )
		{
		URL url ( identity.configURL ) ;
		Codec :: decode<URL,Settings> ( url , mConfig ) ;
		}
	
	
	
} ;




NamespaceEnd

#endif
